package cn.kstry.demo.config;

import cn.kstry.demo.enums.StartIdEnum;
import cn.kstry.framework.core.role.*;
import cn.kstry.framework.core.role.permission.Permission;
import cn.kstry.framework.core.util.PermissionUtil;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author lykan
 */
@Component
public class RoleRegister implements BusinessRoleRegister {

    @Override
    public List<BusinessRole> register() {

        List<String> list = Lists.newArrayList();
        list.add("r:check-img@triple");
//        list.add("r:init-sku");
        List<Permission> permissions = PermissionUtil.permissionList(String.join(",", list));

        Role role = new ServiceTaskRole();
        role.addPermission(permissions);
        BusinessRole businessRole = new BusinessRole("special-channel", StartIdEnum.GOODS_SHOW.getId(), role);
        return Lists.newArrayList(businessRole);
    }
}
